package com.fh.shop.api.mq.product;

import com.fh.shop.api.mq.config.MQConstant;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class HelloProducer {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendMsg(String msg){
        rabbitTemplate.convertAndSend(MQConstant.Test.EX,MQConstant.Test.ROUTE_KEY,msg);
    }

    public void sendFanoutMsg(String msg){
        rabbitTemplate.convertAndSend(MQConstant.TestFanout.EX,"",msg);
    }

}
